package com.lin.event;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;

/**
 * @创建人 lin
 * @创建时间 2019/9/8
 * @描述
 */
@Configuration
public class EventConfig implements ApplicationEventPublisherAware {
    private ApplicationEventPublisherAware applicationEventPublisherAware;

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisherAware = applicationEventPublisherAware;
    }

    @EventListener({Event.class})
    public void EventListenser(Event event){
        System.out.println("事件正在监听"+event);
    }
}
